EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
        if IsMouseButtonPressed(1) then
        else
            Sleep(1)
        end

        i = 0;
        while (IsMouseButtonPressed(1) and i < 220) do
            if (IsModifierPressed("lctrl") or IsKeyLockOn("capslock")) then
                p = 1;
                if i < 13 then
                    p = 2
                elseif (i>=23 and i < 36) then
                    p = 3
                else
                    p = 4
                end

                move(p)
                Sleep(10)
                --MoveMouseRelative(0,p);
            end
            i = i + 1
            --sleep1(10)
            
        end

    end
end

function outM()
x, y = GetMousePosition()
OutputLogMessage("Mouse is at %d, %d\n", x, y)
end


function sleep1(arg)
  while(arg>0) do
    arg=arg-1;
    Sleep(1);
    end
end

function move(arg)
  while(arg>0) do
    arg=arg-1;
    MoveMouseRelative(0,arg);
  end
end